import {
  exportUrl,
  downloadTemplateUrl,getCategoryList,
} from '@/api/inspection/mesOfflineInspectionItem'

import {exportExcel} from '@/utils/judge'
import {getResult} from "@/api/fqc/mesFqcTaskDetail";
import {getDict} from "@/api/common";

// 列表头按钮配置
export const operateList = [
  {
    name: "导出",
    type: "primary",
    icon: "el-icon-download",
    handleName: "export", //点击时返回的标识
    url: exportUrl,
    //auth: "auth:operlog:export", //权限字段
  },
  {
    name: "新增",
    type: "primary",
    icon: "el-icon-circle-plus-outline",
    handleName: "add", //点击时返回的标识
  },
  {
    name: "删除",
    type: "danger",
    icon: "el-icon-delete",
    handleName: "deleteBatch", //点击时返回的标识
    isMultiple: true, // isSingle 表示必须选择一项//isMultiple: true, // 表示必须多选
  },
  {
    name: "导入",
    type: "primary",
    icon: "el-icon-circle-plus-outline",
    handleName: "import", //点击时返回的标识
  },
]
// 行末按钮配置
export const rowConfig = [
  {
    name: "修改",
    type: "primary",
    class: "row-btn-primary",
    handleName: "edit", //点击时返回的标识
  },
  {
    name: "详情",
    type: "info",
    class: "row-btn-info",
    handleName: "detail", //点击时返回的标识
  },
  {
    name: "删除",
    type: "danger",
    class: "row-btn-danger",
    handleName: "delete", //点击时返回的标识
  },
]
// 搜索条件配置
export const searchConfig = {
  inline: true,
  formDesc: {

    category: {
      type: "select",
      label: "分类",
      required: false,
      prop: {
        value: "value",
        text: "description",
      },
      options: async (data) => {
        const list = await getCategoryList();
        return list.data.result;
      },
    },
    inspectionType: {
      type: 'input',
      label: '检验类型',
      // prop: {
      //   value: 'value',
      //   text: 'description'
      // },
      // options: async (data) => {
      //   const list = await getDict('mes_barcode_reprint_status')
      //   return list.data.result
      // }
    },
    inspectionSection: {
      type: 'input',
      label: '检验部位',
    },
    projectType: {
      type: 'input',
      label: '项目类型',
    },
    inspectionMethod: {
      type: 'input',
      label: '检验方法',
    },
    inspectionRequirements: {
      type: 'input',
      label: '检验要求',
    },
  },
}
// 新增/删除表单配置
export const formDescDialog = {
  span: 24,
  disabled: false,
  isShowSubmitBtn: true,
  formDesc: {
    category: {
      type: "select",
      label: "分类",
      layout: 12,
      required: false,
      prop: {
        value: "value",
        text: "description",
      },
      options: async (data) => {
        const list = await getCategoryList();
        return list.data.result;
      },
    },
    inspectionType: {
      type: "input",
      label: "检验类型",
      layout: 12,
      required: false,
    },
    inspectionSection: {
      type: "input",
      label: "检验部位",
      layout: 12,
      required: false,
    },
    projectType: {
      type: "input",
      label: "项目类型",
      layout: 12,
      required: false,
    },
    inspectionMethod: {
      type: "input",
      label: "检验方法",
      layout: 12,
      required: false,
    },
    inspectionRequirements: {
      type: "textarea",
      label: "检验要求",
      layout: 12,
      required: false,
    },
    remark: {
      type: "input",
      label: "备注",
      layout: 12,
      required: false,
    },
    // factoryCode: {
    //   type: "input",
    //   label: "",
    //   layout: 12,
    //   required: false,
    // },
  },
}
//导入数据
export const importFormDescDialog = {
    span: 24,
    disabled: false,
    isShowSubmitBtn: true,
    formDesc: {
        model: {
            type: "button",
            label: "",
            layout: 24,
            required: false,
            title: '下载模板',
            style: {
                color: '#1867c0',
                fontSize: '14px'
            },
            on: {
                click: () => {
                    exportExcel(downloadTemplateUrl)
                }
            }
        },
        file: {
            type: "input",
            label: "文件选择",
            layout: 24,
            // required: true,

        },
    }
}

